#
# amiga makefile generics
#

CC      = ppc-amigaos-gcc -mcrt=clib2 -I${PREFIX}/clib2/include
CXX     = ppc-amigaos-g++ -mcrt=clib2 -I${PREFIX}/clib2/include
STRIP   = ppc-amigaos-strip --strip-unneeded
OBJCOPY = true
CHMOD   = true

BINEXT  = .exe

DSOLDFLAGS = -shared
DSOPRE     = lib
DSOPOST    = .so
DSORPATH   = -Wl,-rpath,${LIBDIR}
DSOSONAME  = -Wl,-soname,

ifeq (${BUILD_MODULAR},1)
ARCH_CFLAGS   += -fPIC
ARCH_CXXFLAGS += -fPIC
ARCH_LDFLAGS  += -use-dynld -lunix
endif

# MZX breaks this optimisation on Amiga
ARCH_CFLAGS   += -fno-strict-aliasing
ARCH_CXXFLAGS += -fno-strict-aliasing

# Amiga needs PNG to be statically linked (inc. zlib)
LIBPNG_LDFLAGS = `libpng12-config --static --ldflags`

#
# Need to nest Amiga binaries in a subdir
#
build := build/${SUBPLATFORM}/MegaZeux
build: ${build}
	${CP} arch/amiga/MegaZeux.info ${build}
	${CP} arch/amiga/MegaZeux.info ${build}/MZXRun.info
	${CP} arch/amiga/MegaZeux.info build/${SUBPLATFORM}
	${CP} arch/amiga/MegaZeux arch/amiga/MZXRun ${build}
	${RM} ${build}/*.debug

include arch/lha.inc
